import time

DEFAULT_FORMAT = "%Y-%m-%d %H:%M:%S"


def time_to_string(format_):
    """
    time 转字符时间
    :param format_: 字符格式
    :return: string
    """
    if format_ is None:
        format_ = DEFAULT_FORMAT
    time_str = time.strftime(format_, time.localtime())
    return time_str
